import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt(), r = in.nextInt();
        int ret = 0;
        for(int i = l; i <= r; i++)
        {
            int tmp = i;
            while(tmp != 0)
            {
                if(tmp % 10 == 2) ret++;
                tmp /= 10;
            }
        }
        System.out.println(ret);
    }
}
